import math

import  numpy as np
'''
二分查找法
'''

def binay_search(list,item):
    low=0
    cont=0
    heigh=len(list)-1
    while low<=heigh:
        mid=math.ceil((low+heigh)/2)
        cont=cont+1
        guess=list[mid]
        if guess == item:
            print('匹配了%d次' %cont)
            return mid
        if  guess  > item:
            heigh=mid-1
        else:
            low=mid+1

    return None


if __name__ == '__main__':
    ar=np.arange(900000000)
    print(binay_search(ar,406003001))
